<template>
  <div id="app">
    <!-- <nav>
      <router-link to="/">Home</router-link> |
      <router-link to="/about">About</router-link>
    </nav> -->
    <!-- <div> 顶部的东西 </div> -->

    <Head />
    <router-view />
  </div>
</template>

<script>
import Head from '@/components/Head.vue'
import { login } from "@/api/login.js"
import { test_user_center } from "@/api/tools.js";
export default {
  components: {
    Head,
  },
  data() {
    return {
      login: JSON.parse(localStorage.getItem('login')) || null
    }
  },
  mounted() {
    this.login?.email && test_user_center({
      email: this.login?.email
      // email: this.$store.state.loginSucInfo.email
      // email: '001@163.com'
    }).then(res => {
      const { code, data } = res || {}
      const { account_info, batch_info } = data || {}
      if (code == 200) {
        this.$store.commit('handleSaveUserInfo', account_info)
        this.$store.commit('handleTableList', batch_info)
      }
      // console.log('--res--', res.data)
    }).catch(err => console.log('err', err))


    let form = JSON.parse(localStorage.getItem('formLogin'))

    // this.login?.email && login({
    //   ...form
    // }).then(res => {
    //   const { code, data, message } = res;
    //   if (code == '200') {
    //     // this.$store.commit('handleLogin', { data, router: this.$router })
    //   }
    // }).catch(err => {
    //   console.log('err', err)
    // })
  },
  methods: {},
  created() {
  }
}
</script>

<style lang="less" scoped></style>
